package com.bdqn.crm.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @TableName product
 */
@TableName(value = "product")
@Data
public class Product implements Serializable {
    /**
     * 编号
     */
    @TableId(type = IdType.AUTO)
    private Long prodId;

    /**
     * 商品名称
     */
    private String prodName;

    /**
     * 商品类型
     */
    private String prodType;

    /**
     * 商品介绍
     */
    private String prodBatch;

    /**
     * 单位
     */
    private String prodUnit;

    /**
     * 价格
     */
    private BigDecimal prodPrice;

    /**
     * 描述
     */
    private String prodMemo;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Product other = (Product) that;
        return (this.getProdId() == null ? other.getProdId() == null : this.getProdId().equals(other.getProdId()))
                && (this.getProdName() == null ? other.getProdName() == null : this.getProdName().equals(other.getProdName()))
                && (this.getProdType() == null ? other.getProdType() == null : this.getProdType().equals(other.getProdType()))
                && (this.getProdBatch() == null ? other.getProdBatch() == null : this.getProdBatch().equals(other.getProdBatch()))
                && (this.getProdUnit() == null ? other.getProdUnit() == null : this.getProdUnit().equals(other.getProdUnit()))
                && (this.getProdPrice() == null ? other.getProdPrice() == null : this.getProdPrice().equals(other.getProdPrice()))
                && (this.getProdMemo() == null ? other.getProdMemo() == null : this.getProdMemo().equals(other.getProdMemo()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getProdId() == null) ? 0 : getProdId().hashCode());
        result = prime * result + ((getProdName() == null) ? 0 : getProdName().hashCode());
        result = prime * result + ((getProdType() == null) ? 0 : getProdType().hashCode());
        result = prime * result + ((getProdBatch() == null) ? 0 : getProdBatch().hashCode());
        result = prime * result + ((getProdUnit() == null) ? 0 : getProdUnit().hashCode());
        result = prime * result + ((getProdPrice() == null) ? 0 : getProdPrice().hashCode());
        result = prime * result + ((getProdMemo() == null) ? 0 : getProdMemo().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", prodId=").append(prodId);
        sb.append(", prodName=").append(prodName);
        sb.append(", prodType=").append(prodType);
        sb.append(", prodBatch=").append(prodBatch);
        sb.append(", prodUnit=").append(prodUnit);
        sb.append(", prodPrice=").append(prodPrice);
        sb.append(", prodMemo=").append(prodMemo);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}